home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / tool / oomoji / oomoji.c next >
Text File  |  1995-08-12  |  941b  |  51 lines

  1. #include<stdio.h>
  2. #include<ctype.h>
  3.  
  4. main(int argc , char *argv[])
  5. {
  6.     int i,lineno,b,c=0;
  7.     FILE *fin,*wri;
  8.     char buf[256],test[256];
  9.     
  10.  
  11.     if(argc!=3){
  12.         puts("\n大文字判定プログラム\n"
  13.              " 用法: run386 oomoji [読み込みファイル名]"
  14.                         " [書き込みファイル名]\n");
  15.         
  16.         exit(1);
  17.     }
  18.  
  19.     if(((wri=fopen(argv[2],"w"))==NULL) || ((fin=fopen(argv[1],"r"))==NULL))    {
  20.         printf("ファイルがオープンできません。\n");
  21.         exit(1);
  22.     }
  23.  
  24.        /* fprintf(wri,"\n行数 文字数 内容\n\n");*/
  25.     lineno=0;
  26.     
  27.     while(fgets(buf,256,fin)!=NULL){
  28.            ++lineno;
  29.             b=c=0; 
  30.             for(i=0;  i<strlen(buf); i++){
  31.                       
  32.                         if(isupper(buf[i])){
  33.                               test[c++]=buf[i];
  34.                             b++;
  35.                         }
  36.              
  37.                 
  38.             }
  39.         test[c]='\0';
  40.         
  41.          if(b!=0) {            
  42.          fprintf(wri,"%4d行  %3d文字  文字列:%s \n%s\n",lineno,b,test,buf);
  43.          } 
  44.       
  45.     }
  46.   fclose(fin);
  47.   fclose(wri);    
  48.   return(0);
  49.  }          
  50.  
  51.